/*
 * Copyright (c) 2012 Keerthi Ramachandran .
 */
package com.kee.example.domain;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * This class... todo (RK) javadoc
 *
 * @author <a href="mailto:Keerthi.Ramachandran@navis.com">Keerthi Ramachandran</a>, 8/29/12
 * @since 2.4. /2012-08-29
 */
@Entity
@AttributeOverride(name = "owner", column = @Column(name = "CC_OWNER",nullable = false))
public class CreditCard extends BillingDetails {
    @Id@GeneratedValue(strategy = GenerationType.AUTO)
    private long id;
    private String ccString;

    public CreditCard() {
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder().appendSuper(super.hashCode()).append(this.id).append(this.ccString).toHashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CreditCard other = (CreditCard) obj;
        return new EqualsBuilder().appendSuper(super.equals(obj)).append(this.id, other.id).append(this.ccString, other.ccString).isEquals();
    }

    public long getId() {
        return id;
    }

    public void setId(long inId) {
        id = inId;
    }

    public String getCcString() {
        return ccString;
    }

    public void setCcString(String inCcString) {
        ccString = inCcString;
    }
}
